package hu.jonas.allunit;

import hu.jonas.allunit.model.TestResultModel;

import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class AllUnitPlugin extends AbstractUIPlugin {

	public static final String PLUGIN_ID = "hu.jonas.allunit";

	private static AllUnitPlugin plugin;
	private static TestResultModel testResultModel = new TestResultModel();
	
	public AllUnitPlugin() {
	}

	public void start(BundleContext context) throws Exception {
		super.start(context);
		plugin = this;
	}

	public void stop(BundleContext context) throws Exception {
		plugin = null;
		super.stop(context);
	}

	public static AllUnitPlugin getDefault() {
		return plugin;
	}
	
	public static ImageDescriptor getImageDescriptor(String path) {
		return imageDescriptorFromPlugin(PLUGIN_ID, path);
	}

	public static void logInfo(String message) {
		getDefault().getLog().log(new Status(Status.INFO, PLUGIN_ID, message));
	}
	
	public static TestResultModel getTestResultModel() {
		return testResultModel;
	}
	
}
